<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>反转</title>
</head>
<script>
   String.prototype.reverse=function () {
    var strarr="";
    for (var i =this.length-1;i>=0;i--){
        strarr+=this[i];
    }
    return this.reverse();
    }
    var str=new String("just do it");
   //var str2="abc";
   //var str2arr=str2.split('');
  // console.log(str2arr);
  // var arr=[];
   //for(var i=str2arr.length-1;i>=0;i--){
   //    arr.push(str2arr[i]);
 //  }
   console.log('反转后的字符串为:',arr.join(''));
</script>
<body>

</body>
</html>